import subprocess

def run_powershell_command(command):
    try:
        subprocess.run(["powershell", "-Command", command], check=True)
    except subprocess.CalledProcessError as e:
        print(f"Command '{command}' execution failed with error code {e.returncode}")
        print(e.output)

# 迁移文件
def run_migration_file():
    run_powershell_command("python daxiongDjango\DRF_MOVIE\manage.py makemigrations")

# 执行数据库迁移
def run_migration_database():
    run_powershell_command("python daxiongDjango\DRF_MOVIE\manage.py migrate")


run_migration_file()
run_migration_database()
